package com.test;

/**
 * @author Administrator
 */
public class Java8Tester {
    public static void main(String args[]) {
        Vehicle vehicle = new Car();
        vehicle.print();
    }
}




interface Vehicle {
    /**
     * 默认方法
     */
    default void print() {
        System.out.println("我是一辆车!");
    }

    /**
     * 静态方法
     */
    static void blowHorn() {
        System.out.println("按喇叭!!!");
    }
}




interface FourWheeler {
    default void print() {
        System.out.println("我是一辆四轮车!");
    }
}




class Car implements Vehicle, FourWheeler {
    /**
     * 创建自己的默认方法，来覆盖重写接口的默认方法：
     */
    public void print() {
        Vehicle.super.print();
        FourWheeler.super.print();
        Vehicle.blowHorn();
        System.out.println("我是一辆汽车!");
    }
}
